const { app } = require('electron');
const lnk = require('lnk');
const path = require('path');

function createDesktopShortcut() {
  try {
    const exePath = app.getPath('exe');
    const desktopPath = app.getPath('desktop');
    const shortcutPath = path.join(desktopPath, `${app.getName()}.lnk`);

    lnk.sync([exePath], {
      destination: shortcutPath,
      force: true,
    });

    console.log('桌面快捷方式创建成功:', shortcutPath);
  } catch (error) {
    console.error('创建快捷方式失败:', error);
  }
}

app.whenReady().then(() => {
  createDesktopShortcut();
  // 其他初始化代码...
});

// 剩下的Electron主进程代码...
